module.exports = function (sequelize, DataTypes) {

  const classrecord = sequelize.define('classrecord', {
    time: DataTypes.DATE
  });
  classrecord.associate = (models)=>{
    // 外键所联系的其他表的字段必须是主键或者unique
    classrecord.belongsTo(models.Class, {
      as: 'Class',
      targetKey:'name',
      foreignKey:'class'
    })
  }
  return classrecord;
}